package com.diguage.dytecode.dynamicproxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * 调用日志
 *
 * @author diguage
 * @since 2016-9-4.
 */
public class LogInvocationHandler implements InvocationHandler {
    private Object realObject;

    public LogInvocationHandler(Object realObject) {
        this.realObject = realObject;
    }
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        String className = realObject.getClass().getName();
        System.out.println(className + "#" + method.getName() + " was invoked. ddd");
        return method.invoke(realObject, args);
    }
}
